local skel = fk.CreateSkill {
  name = "emo__shuanghun",
  tags = {Skill.Compulsory},
}

Fk:loadTranslationTable{
  ["emo__shuanghun"] = "双魂",
  [":emo__shuanghun"] = "锁定技，每回合每项限一次，你使用与当前转化项颜色相同的牌时摸一张牌。",
}

skel:addEffect(fk.CardUsing, {
  anim_type = "drawcard",
  can_trigger = function (self, event, target, player, data)
    if target == player and player:hasSkill(skel.name) and data.card.color ~= Card.Red
     and not table.contains(player:getTableMark("emo__shuanghun-turn"), data.card.color) then
      if data.extra_data and data.extra_data[skel.name] then return true end
      local state = data.card.color == Card.NoColor and fk.SwitchYang or fk.SwitchYin
      for _, s in ipairs(player:getSkillNameList()) do
        local skill = Fk.skills[s]
        if skill:hasTag(Skill.Switch) and player:getSwitchSkillState(s) == state then
          return true
        end
      end
    end
  end,
  on_use = function (self, event, target, player, data)
    player.room:addTableMark(player, "emo__shuanghun-turn", data.card.color)
    player:drawCards(1, skel.name)
  end,
})

return skel
